package com.wh1200.mybatis.xmlless.util

import com.wh1200.mybatis.xmlless.constant.SQLKeywords
import com.wh1200.mybatis.xmlless.dialect.DialectFactory

/**
 *
 * @author 吴昊
 * @date 2024/1/16 12:43
 * @since v0.0.0
 * @version 1.0
 */
object ColumnUtils {

  fun wrapColumn(column: String): String {
    return when {
      column.uppercase() in SQLKeywords.getValues() -> {
        DialectFactory.getDialect(DbTypeHolder.getDBType())
            .wrapColumnIfMatchKeywords(column)
      }

      else                                          -> column
    }
  }

}
